# -*- coding: utf-8 -*-
# Author: xiantingDeng
# File: 02_闭包.py
# Time: 9:31

#
# def outer_func():
#     loc_list = []
#
#     def inner_func(name):
#         loc_list.append(len(loc_list) + 1)
#         print('%s loc_list = %s' % (name, loc_list))
#
#     return inner_func
#
#
# clo_func_0 = outer_func()
# clo_func_0('clo_func_0')
# clo_func_0('clo_func_0')
# clo_func_0('clo_func_0')
# clo_func_1 = outer_func()
# clo_func_1('clo_func_1')
# clo_func_0('clo_func_0')
# clo_func_1('clo_func_1')
#
# print("__"*50)
# def test(number):
#
#     print("--1--")
#
#     def test_in(number2):
#         print("--2--")
#         print(number+number2)
#
#     print("--3--")
#     return test_in
#
#
# ret = test(100)
# print("-"*30)
# ret(1)
# ret(100)
# ret(200)

# def test(a, b):
#     def test_in(x):
#         print(a * x + b)
#
#     return test_in
#
#
# line1 = test(1, 1)
# line1(0)
# line2 = test(10, 4)
# line2(0)
#
# line1(0)

# def my_func(*args):
#     fs = []
#     for i in range(3):
#         def func():
#             return i * i
#
#         fs.append(func)
#     return fs
#
#
# fs1, fs2, fs3 = my_func()
# print(fs1())
# print(fs2())
# print(fs3())


def e_test(number):
    print("____1____")
    def e_test_in(number2):
        print("___2___")
        return number+number2
    print("___3___")
    return e_test_in

if __name__ == "__main__":
    # ret = e_test(1000)
    print(e_test(100)(200))